package com.demo.spring.service;

import com.demo.spring.model.User;
import com.demo.spring.model.UserVo;
import com.demo.spring.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserService {

    @Autowired
    private UserRepository userRepository;

    public void add(User user) {
        userRepository.save(user);
    }

    public List<User> queryName(String name) {
        return userRepository.queryName(name);
    }

    public UserVo queryUserVo() {
        return userRepository.queryUserVo();
    }
}
